'use strict';
const {getDefaultModelConfig} = require("../../utils/common");

module.exports = app => {
    const { STRING, INTEGER, TINYINT } = app.Sequelize;
    return app.model.define(
        'Banner',
        {
            id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            image_url: STRING(255),
            link_url: STRING(255),
            position: {type: STRING(50), allowNull: false, comment: '公告位置：interview-面试，written-笔试'},
            product_id: {type: INTEGER, defaultValue: 0},
            sort: {type: INTEGER, defaultValue: 0},
            status: {type: TINYINT, defaultValue: 1},
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'banner',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );
};
